package uk.org.landeg.euler.problems;

import uk.org.landeg.euler.problems.framework.AbstractProblem;
import uk.org.landeg.euler.problems.framework.ProblemLauncher;

public class Problem063 extends AbstractProblem {
	public static void main(String[] args) {
		ProblemLauncher launcher = new ProblemLauncher(new Problem063());
		launcher.solve();
	}

	@Override
	public String getDescription() {
		return "How many n-digit positive integers exist which are also an nth power?";
	}

	@Override
	public Integer getProblemNumber() {
		return 63;
	}

	@Override
	public Object solve() {
		notes.add("Taking x^y, x has an upper limit of 10");
		notes.add("for given y the min value of x is 10^(1-1/y)");
		notes.add("1^1 is not yeilded by this solution (x>1 as opposed to x>=1, so add 1 at the end");
		int count = 0;
		int thisCount;
		double y = 1.0;
		do {
			thisCount = 9 - (int)Math.pow(10, (1-(1/y)));
			System.out.println(y+"\t"+thisCount);
			count+=thisCount;
			y+=1.0;
		} while (thisCount >0);
	
		return ++count;
	}

}
